Defining and Calling Subroutines
A subroutine definition contains
-
a template for calls to the subroutine
-
optional variable declarations
-
statements; among these can be a Return statement that when executed returns a value and exits the subroutine
You cannot nest subroutine definitions; that is, you cannot define a subroutine within a subroutine definition.
The way you call a subroutine is determined by the way the subroutine was defined:
-
You must provide all the parameters specified in the definition.
-
You must provide either labeled parameters or positional parameters, as specified in the definition.
The following sections describe how to define and call subroutines:
© 1999 Apple Computer, Inc. – (Last Updated 21 May 99)